<?php

function formataValor($valor,$op){
    $val = explode('.', $valor);
    
    if($op == 0) return $val[0];
    else if($op == 1) return $val[1];
    else return $valor; 
    
}

?>



    <div class="st-cp-pg-pacotes">        
        <h2>
            <img class="imgAspas" src="<?php echo $this->urlbase.'/public/media/images/icone_titulo.png'?>" alt="<?php echo $this->titulo; ?>"/>
                Pacotes
            <img class="imgAspas" src="<?php echo $this->urlbase.'/public/media/images/icone_titulo.png'?>" alt="<?php echo $this->titulo; ?>"/>
        </h2>
        <div class="imgsPacotes">
            <?php foreach($this->result as $row){ 
                $imgs = glob('public/upload/pacote/'.$row['PCT_ID'].'.*');
                $img = $imgs[0];
            ?>
            <div class="col">
            <?php if(strlen($img) > 3) { ?>
                <img class="icone" src="<?php echo $this->urlbase.'/public/media/images/icone-pacote.png'; ?>" alt="<?php echo $this->titulo; ?>" >
                <img src="<?php echo $this->urlbase.'/'.$img;?>" alt="<?php echo $this->titulo; ?>" />
            <?php }?>
                <div class="st_cima"></div>
                <div class="conteudo">
                    <h2><?php echo $row['PCT_NOM'];?></h2>
                    <div class="txtcol"><?php echo $row['PCT_TXT'];?></div>
                    <div class="content_val">
                    <?php if($row['PCT_VALPRO'] > 0 && (strtotime($row['PCT_DATPRO']) >= strtotime(date('Y-m-d')) || $row['PCT_DATPRO'] == '0000-00-00') ){ ?>
                        <div class="txtvalmen"><span class="valde">De</span> <span class="xpor"></span><span class="valrs">R$</span> <?php echo formataValor($row['PCT_VAL'],0);?><span class="valrspor"><?php echo '.'.formataValor($row['PCT_VAL'],1);?></span></div>
                        <div class="txtval"><span class="valde">Por</span> <span class="valrs">R$</span> <?php echo formataValor($row['PCT_VALPRO'],0);?><span class="valrspor"><?php echo '.'.formataValor($row['PCT_VALPRO'],1);?></span> <span class="txtvaltxt"><?php echo $row['PCT_VALTXT'];?></span></div>
                    <?php } else { ?>
                        <div class="txtval v_mdl"><span class="valrs">R$</span> <?php echo formataValor($row['PCT_VAL'],0);?><span class="valrspor"><?php echo '.'.formataValor($row['PCT_VAL'],1);?></span> <span class="txtvaltxt"><?php echo $row['PCT_VALTXT'];?></span></div>
                    <?php }?>
                    </div>
                    <?php if($row['PCT_STADATPRO'] == 1 && $row['PCT_VALPRO'] > 0 && strtotime($row['PCT_DATPRO']) >= strtotime(date('Y-m-d'))){ ?>
                        <div class="datpro">Promoção Válida até <?php echo Datetools::amd_dma($row['PCT_DATPRO']);?></div>
                    <?php }?>
                </div>
                <div class="registrar" cod-pacote='<?php echo $row['PCT_ID'];?>'><a href="javascript:void(0);">Registre-se aqui <img src="<?php echo $this->urlbase; ?>public/media/images/icone_seta_direita.png" alt="<?php echo $this->titulo; ?>"></a></div>
            </div>
            <?php } ?>
        </div>
         <?php if($this->total['TOTAL'] > $this->limitRegistros){ ?>
            <div class="cont_ms_proc" style="text-align: center;clear: both;padding: 30px;">
                <a href="javascript:void(0)" class="maispacotes" offset="0"><span>MAIS PACOTES</span></a>
            </div>
        <?php } ?>
    </div>
<a class="fc_popup" href="#popup"></a>
<div id="popup" class="ctn-popup" style="display: none;">
    <div class="cab_popup">
        <h3>Registro de Interesse</h3>
    </div>
    
    <form id="form" class="form_popup">
        <input type="hidden" id="cod-pacote" name="cod-pacote" value=""/>
        <table>
            <tr>
                <td><span>nome</span></td>
                <td><input type="text" id="nome" name="nome"/></td>
            </tr>
            
            <tr>
                <td><span>telefone</span></td>
                <td><input type="text" id="telefone" class="telefone" name="telefone"/></td>
            </tr>
            
            <tr>
                <td><span>e-mail</span></td>
                <td><input type="text" id="email" name="email"/></td>
            </tr>
            
            <tr>
                <td><span>cidade</span></td>
                <td><input type="text" id="cidade" name="cidade"/></td>
            </tr>
                <td width="75%"></td>
                <td align="right">
                    <button type="submit" width="50px;" id="enviar" name="enviar">enviar</button>
                </td>
            <tr>
                
            </tr>
        </table>
     </form>
</div>
<script type="text/javascript" src="<?php echo $this->urlbase; ?>/public/media/js/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
<link rel="stylesheet" type="text/css" href="<?php echo $this->urlbase; ?>/public/media/js/fancybox/source/jquery.fancybox.css?v=2.1.5" media="screen" />
<script type="text/javascript" src="<?php echo $this->urlbase; ?>/public/media/js/view/pacotes.js"></script>
